<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateAuthPermissionTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('auth_permission', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name')->commit('权限名称');
            $table->unsignedInteger('content_type_id');
            $table->foreign('content_type_id')
                ->references('id')->on('content_type')
                ->onDelete('cascade');
            $table->string('codename')->commit('返回状态码名称');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('auth_permission');
    }
}
